import { requestClient } from '#/api/request';

export function SaveOrUpdate(obj: any) {
  return obj.id ? UpdateObj(obj) : AddObj(obj);
}

export function AddObj(obj: any) {
  return requestClient.request('/iam/system/menu', {
    method: 'post',
    data: obj,
  });
}

export function DelObj(id: any) {
  return requestClient.request(`/iam/system/menu/${id}`, {
    method: 'delete',
    data: { id },
  });
}

export function UpdateObj(obj: any) {
  return requestClient.request(`/iam/system/menu/${obj.id}`, {
    method: 'put',
    data: obj,
  });
}
export function GetPage(query: any) {
  return requestClient.post(`/iam/system/menu/page`, {
    page: { current: query.current, size: query.size },
    model: {
      type: query?.type,
      parentId: Number(query?.parentId),
    },
  });
}

export function GetBuildStandardList(query: any) {
  return requestClient.request('/iam/dynamic_release_drag', {
    method: 'get',
    params: query,
  });
}
